﻿using PureMVC.Interfaces;
using PureMVC.Patterns;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

///<summary>
///
///</summary>
public class EndMediator : Mediator
{
    public new static string NAME = "EndMediator";
    EndView view;
    public EndView EndView
    {
       get{
            if (view == null)
            {
                view = GameObject.Find("Canvas/Ending").GetComponent<EndView>();
            }
            return view;
           }  
    }
    public EndMediator() : base(NAME)
    {
        EndView.Init();
        EndView.Again += () =>
        {
            EndView.ClosePanel();
            EndView.RestGame();
            StateManager.GetInstance.IsSkipGameScnen = true;
        };
        EndView.OpenShop += () =>
        {
            StateManager.GetInstance.IsSkipShopPanel = true;
            EndView.ClosePanel();
        };
    }
    public override IList<string> ListNotificationInterests()
    {
        IList<string> notifications = new List<string>();
        notifications.Add(GameEvents.RETURN_END);
        return notifications;
    }
    public override void HandleNotification(INotification notification)
    {
        switch (notification.Name)
        {
            case GameEvents.RETURN_END:
                EndView.ShopReturnEnd();
                break;
        }
    }

}

